package com.his.controller;


import com.his.entity.Diagnosis;
import com.his.entity.Diagnosis;
import com.his.entity.ResponseResult;
import com.his.service.IDiagnosisService;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 诊断类型（疾病）表 前端控制器
 * </p>
 *
 * @author Demoon Liu
 * @since 2022-02-20
 */
@Tag(name="DiagnosisController--诊断管理接口")
@RestController
@RequestMapping("/diagnosis")
public class DiagnosisController {
    @Resource
    public IDiagnosisService diagnosisService;

    @Operation(summary = "添加诊断目录",description ="输入：diagnosis（除id外所有信息）。 返回：一个diagnosis信息 ")
    @PostMapping("/add")
    public ResponseResult addDiagDiag(@RequestBody Diagnosis diagnosis){
        return diagnosisService.addDiag(diagnosis);
    }

    @Operation(summary = "删除诊断",description ="输入：id。 返回：无 ")
    @PostMapping("/delete")
    public ResponseResult deleteDiagDiag(@RequestBody long id){
        return diagnosisService.deleteDiag(id);
    }

    @Operation(summary = "更新诊断",description ="输入：diagnosis（除id外所有信息）。 返回：一个diagnosis信息 ")
    @PostMapping("/update")
    public ResponseResult updateDiagDiag(@RequestBody Diagnosis diagnosis){
        return diagnosisService.updateDiag(diagnosis);
    }


    @Operation(summary = "查找所有诊断",description ="输入：无。 返回：多个diagnosis信息 ")
    @PostMapping("/selectall")
    public ResponseResult selectAllDiagDiag(){
        return diagnosisService.selectAll();
    }

    @Operation(summary = "模糊查询诊断",description ="输入：String类型的（name或者code）。 返回：多个diagnosis信息 ")
    @PostMapping("/selectlike")
    public ResponseResult selectLikeDiag(@RequestBody String str){ return diagnosisService.selectDiag(str); }

}
